
<%@page import="thelist.thelistChannel"%>
<%@page import="usr.Usr" %>
<%@page import="pagePrint.pagePrintThat" %>
<%@page import="page.PageState" %>
<%@page import="javax.servlet.http.HttpSession" %>

<html>
	
	<head>
		<title>
		ifttt / Create task
		</title>
		<link rel="stylesheet" type="text/css" href="css/ifttt.css" />
		<script type="text/javascript" src="javascript/jquery.js"></script>

		<link href='img/favicon2.ico' rel='shortcut icon' type='image/ico' />
		<script type="text/javascript">
			$(function() {
				$("[id='header_nav_t']").click(function() {
					if ( $("div#nav_down").is(":visible") )
						$("div#nav_down").hide();
					else
						$("div#nav_down").show();
				});
			});
		</script>
	</head>
	
	<%
		HttpSession sess = request.getSession();
		Usr usr = (Usr)sess.getAttribute("usr");
		if(usr == null) {
			request.setAttribute("error_cause", PageState.LOGIN_NOT_EXIST);
			request.getRequestDispatcher("login.jsp").forward(request, response);
		} else {
	%>
	

	
	<body class='ifttt signed_out' id='body_area' style="min-height:1600px">
		<div class='coming_soon' id='wrap_all'>
			<div id='header'>
				<div id='header_inner'>
					<div id='title'>
						<h1 style='font-size:32px;'>
							<a class='logo_box_nerd' href='dashboard.jsp' title='Dashboard'>
								<img src='img/ifttt.png' style='margin:10px 0 0 0; 
									width:30px; height:30px;'></img>
							</a>
							<a href="newtask.jsp">
							create task
							</a>
						</h1>
					</div>
					
					<div class='nav_right_side'>

						<div id='right_top_meta'>
							<div id='account_meta'>
								<div id='user_nav'>
									<div class='dark' id='signed_in_as'>
										<div id='user_name'>
											<a href="dashboard.jsp">
											<%
												out.println(usr.getLogin());
											%>
											</a>
										</div>
									</div>
								</div>
							</div>
						</div>
						
						<div class='header_nav' style='font-weight:bold'>
							<a href='tasks.jsp'>
							<div class='signup_menu nav_menu'
									style="width:60px;
									margin:auto 2px auto 0;
									border-bottom-right-radius:0;">
								Tasks
							</div>
							</a>
						</div>
						<div class='header_nav' style='font-weight:bold'>
							<a href='msgs.jsp'>
							<div class='signup_menu nav_menu'
									style="width:80px;
									margin:auto 2px auto 2px;
									border-radius:0;">
								Message
							</div>
							</a>
						</div>
						<div class='header_nav' style='font-weight:bold'>
							<a href='channels.jsp'>
							<div class='signup_menu nav_menu'
									style="width:90px;
									padding:auto 0 auto 0;
									margin:auto 2px auto 2px;
									border-radius:0;">
								Channels
							</div>
							</a>
						</div>
						<div id='header_nav_t'>
							<div class='signup_menu nav_menu'>~
							</div>
						</div>

					</div>
				</div>
			</div>
			
			<div class='clear'></div>
			
			<div id='nav_down'>
				<a href='user.jsp'>
				<div class='nav_down_item'>User</div>
				</a>
				<% if ( usr.getCredit() == 0 ) { %>
				<a href='users.jsp'>
				<div class='nav_down_item'>Users</div>
				</a>
				<% } %>
				<a href='login.jsp'>
				<div class='nav_down_item'>Sign Out</div>
				</a>
			</div>
			
			<div class='clear'></div>
			
			<%
				int pay = usr.getPay();
				if(usr.getMoney() < pay)
				{
					request.setAttribute("error_money", "fuck");
					request.getRequestDispatcher("dashboard.jsp").forward(request, response);
				}
			%>
			
			<div>
				<div class="step_title">
					<span class="step_t">
						Choose trigger channel
					</span>
					<span class="of_step">
						step 2 of 7
					</span>
					<a href='newtask.jsp'>
					<span class="restart">
						back
					</span>
					</a>
					<div class='clear'></div>
				</div>
				<div class='clear'></div>
				

			</div>
			
			<div class='clear'></div>
			<br />
			<%
				thelistChannel.listThatChannels(pageContext);
			%>
			<div class = 'clear'></div>
			<br>
			<%
				Object oid = request.getAttribute("thatid");
				int id;
		
				if(oid != null)	//select a channel
				{	//show step 5
					id = (Integer)oid;
					pagePrintThat.Print(out, id);
					out.flush();
					
					Object oteveid = request.getAttribute("teveid");
					if(oteveid != null)
					{	//show step 6
						int teveid = (Integer)oteveid;
						pagePrintThat.Print_Deep(out, id, teveid);
						out.flush();
					}
				}
			%>
		
		</div>
		<div class='clear'></div>
		<div>
	
	</div>
		<% } %>
		<div class='clear'></div>
		
		<div id='footer_inner'>
			<div id='logo'>
				<h2 class='ifttt_logo_footer'>
					<span class='full_logo_text'>
						<a href="index.html" title="Return to home page">ifttt</a>
					</span>
				</h2>
				<div class="njucs">
					NJUCS
				</div>
			</div>
			<div id='other_links'>
				<div>
					<span><a href="u.html">About</a></span>
					<span><a href="http://code.google.com/p/njucs-ifttt/">Blog</a></span>
					<span><a href="http://ws.nju.edu.cn">Contact</a></span>
					<span><a href="http://code.google.com/p/njucs-ifttt/">Terms</a></span>
					<span><a href="index.html">Privacy</a></span>
					<div class='clear'></div>
				</div>
			</div>
			<div class='break'></div>
			<div id='created_in'>
			Created in njucs
			</div>
		</div>
	</body>
</html>
